package com.piano.moguyun.utils;

import android.annotation.SuppressLint;
import android.text.TextUtils;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

/**
 * 时间工具
 */
public class TimeUtils {


    /**
     * 获取当月第一天
     * @return
     */
    public static String getMmFirstDate(){
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Calendar c = Calendar.getInstance();
        c.add(Calendar.MONTH, 0);
        c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
        String first = format.format(c.getTime());
        System.out.println("-----1------first:"+first);
        return first;
    }
    /**
     * 获取当月最后一天
     * @return
     */
    public static String getMmLastDate(){
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Calendar ca = Calendar.getInstance();
        ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
        String last = format.format(ca.getTime());
         System.out.println("-----1------last:"+last);
        return last;
    }

    /**
     * 获取当前时间戳 13位
     * @return
     */
    public static long getTimeMillis(){
        return System.currentTimeMillis();
    }
}
